# 2024/1/10 18:46 HFL
import xlwings


def readExcel(fpath, shAB,sht):
    """
    Excel读取测试数据
    :param fpath:
    :param shAB:
    :return:
    """
    # 创建一个对象
    xwa = xlwings.App(False, False)
    # 打开工作簿
    wb = xwa.books.open(fpath)
    sht = wb.sheets(sht)
    data = sht.range(shAB).value
    r = len(data)
    c = len(data[0])
    for i in range(r):
        for j in range(c):
            if data[i][j] is None:
                data[i][j] = ''

    wb.close()
    xwa.quit()
    return (data)


if __name__ == '__main__':
    fpath = '../testdata/tpshop.xlsx'
    shAB = 'A2:J20'
    sht='member'
    testdata = readExcel(fpath, shAB,sht)
    # for i in testdata:
    #     for j in i:
    #         print(j[0])
    print(testdata)